import "./index.less";
import { useNavigate } from "react-router-dom";
import { NavBar, Tabs, SearchBar, Badge } from "antd-mobile";
import React, { useRef, useEffect, useState } from 'react'
import { publicDisclosureResidentialAffairs } from "../servece";

const DomesticAffairs: React.FC = () => {
  const navigate = useNavigate();
  const [dataList, setDataList] = useState([])
  const goto = (url: string) => () => {
    navigate(url);
  }
  useEffect(()=>{
    publicDisclosureResidentialAffairs({ villageCode: "511602006004",/* classType:selectType  */})
      .then((res) => {
        if (res.code == 200) {
          console.log(res.data);
          setDataList(res.data)
        } else {
          console.log(res.data);
        }
      })
      .catch((error) => {
        console.log(error);
      });
  },[])


  return (
    <div className="domesticAffairs">
      <div className="domesticAffairs_content">
        {
          dataList?.map((item, index) => {
            return <div
              key={item?.title}
              className="content_List-item"
              onClick={goto(`/contentDetails?type=${"domesticAffairs"}&&detail=${item?.id}`)}
            >
              <div className="content_List-item-imformation">
                <div className="imform_left">
                  <div className="imformation-name">{item?.title}</div>
                  <div className="imformation-professional">{item?.createTime}</div>
                </div>
                <div className="imform_right">
                  <img src={item?.img||"/images/mycommunity/noImage.jpg"} alt="" />
                </div>
              </div>
            </div>
          })
        }
      </div>
    </div>
  );
};

export default DomesticAffairs;
